package homework;

public class StringReverse {
    public static void main(String[] args) {
        String a = "abc";
        String b = "";
        //反转字符串 倒序循环
        for(int i=a.length()-1;i>=0;i--){
            b = b+a.charAt(i);
        }
        System.out.println(b);
        //可以使用StringBuffer 进行反转
        StringBuffer a1 = new StringBuffer(a);
        a1.reverse();
        System.out.println(a1);
    }
}
